<!DOCTYPE html>
<html style="height:270px">
   <head>
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
       <script src="jquery-2.1.0.js"></script>
   </head>
   <body style="height: 270px; margin: 0">
       <div id="container" style="height: 270px"></div>
       <script type="text/javascript" src="ec.js"></script>
       <script type="text/javascript">
           function GetUrlParam(paraName) {
               var url = document.location.toString();
               var arrObj = url.split("?");

               if (arrObj.length > 1) {
                   var arrPara = arrObj[1].split("&");
                   var arr;

                   for (var i = 0; i < arrPara.length; i++) {
                       arr = arrPara[i].split("=");

                       if (arr != null && arr[0] == paraName) {
                           return arr[1];
                       }
                   }
                   return "";
               }
               else {
                   return "";
               }
           }
        var token=GetUrlParam('token');
//                'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjIsImV4cGlyZSI6MTU2MjQ2NjYzNywiY29kZSI6ImFhc3dkZHNzIiwicmVnX2lkIjoiMTU0NTQ1NDUifQ.-WhgpSQJi9dCDwlBmSEK2exX05wQcKGGFcec2saBjUE&p';

            function aj(){
                $.ajax({
                    url:'http://47.52.188.179/public/index.php/climg?token='+token,
//               data:{token:token},
                    type:'GET',
                    dataType:'json',
//               dataType:"jsonp",  //数据格式设置为jsonp
                    jsonp:"callback",
                    success:function(res){
                        var time = res.data.time
                        var dom = document.getElementById("container");
                        var myChart = echarts.init(dom);
                        var app = {};
                        option = null;
                        option = {
                            xAxis: {
                                type: 'category',
                                data: time.reverse()
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: [{
                                data: res.data.lv.reverse(),
                                type: 'line'
                            }]
                        };
                        if (option && typeof option === "object") {
                            myChart.setOption(option, true);
                        };
                    },
                    error:function(res){
                        console.log(res)
                    }
                })
            }
           aj();
           setInterval(function(){
               aj();
           },60000)
       </script>
   </body>
</html>